<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true" CodeFile="SearchPage.aspx.cs" Inherits="MB.TheBeerHouse.UI.SearchPage" Title="Online Shopping MALL" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">

<table border="0">
    <tr>
        <td style="width: 100px;">
            <asp:Label ID="searchLabel" runat="server" Text="Search Criteria:"></asp:Label>
        </td>
        <td style="width: 300px;">
            <asp:TextBox Width="300px" ID="searchKey" runat="server"></asp:TextBox>
        </td>
        <td style="width: 10px;">
            &nbsp;
        </td>
        <td style="width: 100px;">
            <!-- Hack to get default submit behavior in IE -->
            <input type="text" style="VISIBILITY: hidden;POSITION: absolute" />
            <asp:Button ID="searchButton" OnClick="searchButton_Click" 
                UseSubmitBehavior="true" Text="Go" runat="server" />
        </td>
    </tr>
</table>
<br />
<asp:GridView Width="100%" ID="bookListView" runat="server" AllowPaging="True" 
    OnRowCommand="bookListView_RowCommand" DataSourceID="Source1"
    AutoGenerateColumns="False" 
    AllowSorting="True" DataKeyNames="ISBN" >
    <Columns>
        <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" 
        ReadOnly="True" InsertVisible="False" Visible="True" />
        <asp:HyperLinkField DataTextField="title" 
            DataNavigateUrlFormatString="~/ShowProduct.aspx?ID={0}" 
            DataNavigateUrlFields="ProductID" HeaderText="Title" SortExpression="Title" />
    </Columns>
</asp:GridView>
<br />
<asp:Label BackColor="#5D7B9D" CssClass="block" Font-Bold="True" ForeColor="White" 
    Text="&nbsp;&nbsp;Details:" runat="server" ID="detailsLabel" Width="100%"></asp:Label>
<asp:DetailsView OnItemCommand="bookDetailsView_ItemCommand" Width="100%" 
    runat="server" ID="bookDetailsView" DataSourceID="Source2" DataKeyNames="ISBN" 
    AutoGenerateRows="false" >
    <Fields>
        <asp:BoundField HeaderStyle-Width="100px" DataField="ISBN" HeaderText="ISBN" 
            ReadOnly="True" InsertVisible="False" Visible="True" />
        <asp:BoundField HeaderStyle-Width="100px" DataField="Title" HeaderText="Title" />
        <asp:BoundField HeaderStyle-Width="100px" DataField="Author" HeaderText="Author" />
        <asp:BoundField HeaderStyle-Width="100px" DataField="UnitsInStock" HeaderText="Number" />
        <asp:ButtonField ControlStyle-Font-Size="0.8em" ControlStyle-Font-Names="Verdana" 
            ControlStyle-BorderStyle="Solid" ControlStyle-BorderWidth="1px" 
            ControlStyle-BorderColor="#CCCCCC" ControlStyle-ForeColor="#284775" 
            ControlStyle-BackColor="#FFFBFF" ButtonType="Button" HeaderText="" />
    </Fields>
</asp:DetailsView>    
<asp:Label ForeColor="Red" Text="" runat="server" ID="detailsComplete" Width="100%"></asp:Label>
<asp:SqlDataSource ID="Source1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString %>"
    SelectCommand="SELECT ISBN, ProductID, Title, substring(Title,0,25) AS shortTitle,
        substring(Author,0,10) as shortAuthor, Author,
        UnitsInStock FROM [tbh_products] ORDER BY [Author], [title]" >
</asp:SqlDataSource>
<asp:SqlDataSource ID="Source2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString %>" >
</asp:SqlDataSource>

</asp:Content>
